/*
 * @Descripttion: 核酸宝项目前端
 * @version: 
 * @Author: 杜宇轩
 * @Date: 2022-05-11 21:42:49
 * @LastEditors: 杜宇轩
 * @LastEditTime: 2022-05-22 06:23:36
 */
import Vue from 'vue';
const prefix = '/natms1/apply/volunteer/';

/**
 * 用户查看自己的志愿者申请
 * request: {}
 */
 export const userCheckApply = () => {
  return Vue.$http({
    url: prefix + 'retrieve',
    method: 'get'
  });
};

/**
 * 用户创建新的志愿者申请
 * request: {
 *  volunteerLocation: "", // 志愿地点
 *  volunteerTime: "" // 志愿时间
 * }
 */
 export const userAddApply = (data) => {
  return Vue.$http({
    url: prefix + 'create',
    method: 'post',
    data: {
      volunteerLocation: data.volunteerLocation,
      volunteerTime: data.volunteerTime
    }
  });
};

/**
 * 用户修改待审批的志愿者申请
 * request: {
 *  id: "", // 志愿信息id
 *  volunteerLocation: "", // 志愿地点
 *  volunteerTime: "" // 志愿时间
 * }
 */
 export const userUpdateApply = (data) => {
  return Vue.$http({
    url: prefix + 'update',
    method: 'post',
    data: {
      id: data.id,
      volunteerLocation: data.volunteerLocation,
      volunteerTime: data.volunteerTime
    }
  });
};

/**
 * 用户撤回待审批的志愿者申请
 * request: {
 *  id: "" // 志愿信息id
 * }
 */
 export const userDeleteApply = (data) => {
  return Vue.$http({
    url: prefix + 'delete',
    method: 'post',
    data: {
      id: data.id
    }
  });
};
